package com.wanxi.controller;

import com.wanxi.dto.ResultDTO;
import com.wanxi.model.Company;
import com.wanxi.model.Contact;
import com.wanxi.service.CompanyService;
import com.wanxi.vo.CompanyVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @author Chengbo Zhang
 */
@RestController
@RequestMapping("/admin/company")
@CrossOrigin(origins = "http://localhost:8081")
public class CompanyController {
    @Autowired
    CompanyService companyService;

    @GetMapping("/find")
    public ResultDTO findCompany(){
        return companyService.findCompany();
    }

    @PostMapping("/update")
    @PreAuthorize("hasAuthority('updateCompany')")
    public ResultDTO updateCompany(CompanyVO companyVO){
        return companyService.update(companyVO);
    }
}
